package cn.gzjp.modules.logis.web;

import cn.gzjp.common.persistence.Page;
import cn.gzjp.common.utils.DateUtils;
import cn.gzjp.common.utils.MyBeanUtils;
import cn.gzjp.common.utils.StringUtils;
import cn.gzjp.common.utils.excel.ExportExcel;
import cn.gzjp.common.utils.excel.ImportExcel;
import cn.gzjp.common.web.BaseController;
import cn.gzjp.modules.gas.service.AliyunSms;
import cn.gzjp.modules.gas.service.GasRechargeService;
import cn.gzjp.modules.logis.entity.LogisCarRoad;
import cn.gzjp.modules.logis.entity.LogisDelivery;
import cn.gzjp.modules.logis.entity.LogisUser;
import cn.gzjp.modules.logis.service.LogisCarRoadService;
import cn.gzjp.modules.logis.service.LogisDeliveryService;
import cn.gzjp.modules.logis.service.LogisUserService;
import com.aliyuncs.exceptions.ClientException;
import com.google.common.collect.Lists;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 财务管理Controller
 * @author zengcp
 * @version 2018-03-22
 */
@Controller
@RequestMapping(value = "${adminPath}/logis/finance")
public class LogisFinanceController extends BaseController {

	@Autowired
	private LogisDeliveryService logisDeliveryService;


	
	/**
	 * 财务管理-订单利润表列表页面
	 */
	@RequestMapping(value = "profit")
	public String profit(LogisDelivery logisDelivery, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<LogisDelivery> page = logisDeliveryService.findPage(new Page<LogisDelivery>(request, response), logisDelivery); 
		model.addAttribute("page", page);
		return "modules/logis/financeProfit";
	}
	/**
	 * 财务管理-司机运费结算列表页面
	 */
	@RequestMapping(value = "driverFreight")
	public String driverFreight(LogisDelivery logisDelivery, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<LogisDelivery> page = logisDeliveryService.findPage(new Page<LogisDelivery>(request, response), logisDelivery);
		model.addAttribute("page", page);
		return "modules/logis/financeDriverFreight";
	}

	/**
	 * 财务管理-推广奖励金列表页面
	 */
	@RequestMapping(value = "reward")
	public String reward(LogisDelivery logisDelivery, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<LogisDelivery> page = logisDeliveryService.findPage(new Page<LogisDelivery>(request, response), logisDelivery);
		model.addAttribute("page", page);
		return "modules/logis/financeReward";
	}

	/**
	 * 财务管理-司机奖励金表列表页面
	 */
	@RequestMapping(value = "driverReward")
	public String driverReward(LogisDelivery logisDelivery, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<LogisDelivery> page = logisDeliveryService.findPage(new Page<LogisDelivery>(request, response), logisDelivery);
		model.addAttribute("page", page);
		return "modules/logis/financeDriverReward";
	}
	/**
	 * 财务管理-合伙人佣金列表页面
	 */
	@RequestMapping(value = "commission")
	public String commission(LogisDelivery logisDelivery, HttpServletRequest request, HttpServletResponse response, Model model) {
		Page<LogisDelivery> page = logisDeliveryService.findPage(new Page<LogisDelivery>(request, response), logisDelivery);
		model.addAttribute("page", page);
		return "modules/logis/financeCommission";
	}


}